home *** CD-ROM | disk | FTP | other *** search
- Path: news.lpr.carel.fi!usenet
- From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
- Newsgroups: comp.lang.c++
- Subject: Re: Why doesn┤t work _fmemcpy > 64kB
- Date: Fri, 01 Mar 1996 16:24:51 +0200
- Organization: Carelcomp Forest
- Message-ID: <313708B3.289B@cmt.lpr.mail.carel.fi>
- References: <4h45r7$apq@aix11.hrz.uni-oldenburg.de>
- NNTP-Posting-Host: renoir.cclahti.carel.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Andreas Weichert wrote:
- >
- > How can I copy data >64kB with Borland C++ 4.0.
- > _fmemcopy works only up to the 3615. Element.
- >
- > int main(void)
- > {
- > long i;
- > const long Size=20000;
- > float huge *p1;
- > float huge *p2;
- > p1=(float* huge)farcalloc(Size,sizeof(float));
- > for(i=0;i<Size;i++) p1[i]=1;
- > p2=(float* huge)farcalloc(Size,sizeof(float));
- > for(i=0;i<Size;i++) p2[i]=2;
- > _fmemcpy((void* huge) p2,(void* huge) p1,Size*sizeof(float));
- > cout<<p2[Size-1]; // -> 1
- >
- > cout<<endl;
- > for(i=0;i<Size;i++)
- > if(p2[i]!=1) {cout<<i; break; } // ->3616
- >
- > return(0);
- > }
-
- The element number seems to be calculated like this (4 = sizeof(float)):
-
- elem = 20000 * 4 - 65536 / 4
-
- Are you sure the size parameter of fmemcpy is 32 bits wide? size_t in 16 bit
- environments tends to be only 16 bits, ie. max 65535. Anything above will wrap
- around.
-
- Later,
- AriL
- --
- All my opinions are mine and mine alone.
-